define(function() {
	return function($compile, $scope) {
		require(
				[ "AppPathDir/fleet/driverInfos/driverSupport", "AppPathDir/fleet/driverInfos/addSupport", "AppPathDir/fleet/driverInfos/updateSupport", "PDUtilDir/util",
						"PDUtilDir/tool", "PDUtilDir/slidebar",
						"PDUtilDir/inputSelect", "Date", "DateCN", "css!DateCss"],
				function(Support, AddSupport, UpdateSupport, Util, Tool, Slidebar, inputSelect) {
					/* 查询 start */
					$scope.search = {
						name: "",
						card_id: ""
					}
					$scope.searchSupport = {
						run: function(){
							$scope.grid.reload({
								queryParam : {
									name : $scope.search.name,
									type : $scope.search.card_id
								}
							})
						}
					};
					/* 查询 end */
					$scope.addSupport = AddSupport($scope, $compile);
					$scope.updateSupport = UpdateSupport($scope, $compile);
					
					$scope.delSupport = {
							run: function(){
								var selectRows = $scope.grid.getSelectedRow();
								if (null != selectRows) {
									Util.confirm("是否要删除", function() {
										var ids = new Array();
										$.each(selectRows, function(index, selectRow) {
											ids.push(selectRow.id);
										});
										$.ajax({
											url : getServer()
													+ "/flea/hclv/driver/deleteByIds.htmls",
											method : 'post',
											data : {
												'ids' : JSON.stringify(ids)
											},
											success : function(data) {
												$scope.grid.refresh();
												Util.alert(data.message);
											}
										});
		
									});
								} else {
									Util.alert('请选择要删除的数据！');
								}
							}
					};
					
					$scope.cache = {
						types : new Array()
					};
					$.ajax({
						url : getServer() + "/flea/hclv/getDrivingModel.htmls",
						success : function(data) {
							$scope.cache.drivingModel = data.data;
							init();
						}
					});
					var init = function(){
					}
					$scope.grid = Support.init($scope.addSupport, $scope.updateSupport, $scope.delSupport, $scope.searchSupport);
				})
	}
});